package com.beerandjesus.webapp.sportofkings.handicapper.struts.action;

import com.opensymphony.xwork2.ActionSupport;
import com.beerandjesus.sportofkings.handicapper.model.JockeyRatingThreshold;
import com.beerandjesus.webapp.sportofkings.handicapper.facade.TransactionFacade;
import com.beerandjesus.webapp.sportofkings.handicapper.facade.RatingThresholdsVO;
import com.beerandjesus.webapp.sportofkings.handicapper.facade.RatingThresholdsException;

import java.util.List;

/**
 * Manage jockey rating thresholds
 * Date: Jun 1, 2012
 * Time: 1:57:03 PM
 */
public class RatingThresholdsAction extends ActionSupport implements RatingThresholdsVO {

    private TransactionFacade facade;
    private List<JockeyRatingThreshold> thresholds;
    private Double leading;
    private Double excellent;
    private Double good;
    private String name;
    private String activeThreshold;
    private String errorMessage;
    private String[] deleteThreshold;

    public String execute() throws Exception {
        try {
            setThresholds(getFacade().doRatingThresholdsAction(this));
        } catch (RatingThresholdsException e) {
            setErrorMessage(e.getMessage());
            setThresholds(e.getResult());
        }
        return SUCCESS;
    }

    public List<JockeyRatingThreshold> getThresholds() {
        return thresholds;
    }

    public void setThresholds(List<JockeyRatingThreshold> thresholds) {
        this.thresholds = thresholds;
    }

    public TransactionFacade getFacade() {
        return facade;
    }

    public void setFacade(TransactionFacade facade) {
        this.facade = facade;
    }

    public Double getLeading() {
        return leading;
    }

    public void setLeading(Double leading) {
        this.leading = leading;
    }

    public Double getExcellent() {
        return excellent;
    }

    public void setExcellent(Double excellent) {
        this.excellent = excellent;
    }

    public Double getGood() {
        return good;
    }

    public void setGood(Double good) {
        this.good = good;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public String getActiveThreshold() {
        return activeThreshold;
    }

    public void setActiveThreshold(String activeThreshold) {
        this.activeThreshold = activeThreshold;
    }

    public String[] getDeleteThreshold() {
        return deleteThreshold;
    }

    public void setDeleteThreshold(String[] deleteThreshold) {
        this.deleteThreshold = deleteThreshold;
    }
}
